home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- CLASS: MiscGaugeCell
- INHERITS FROM: Cell
- PROGRAMMER: Todd Thomas, Copyright 1995
- DATE BEGAN: March 09, 1995
- LAST CHANGED: March 21, 1995
- VERSION: 0.4
- CHANGES: See the end of the implementation file.
-
- This class takes care of everything needed to display a gauge. It
- should also be pretty easy to use your own gauge face and hand in
- a subclass by overriding drawHand:flipped: and drawFace:. See the
- documentation for more details.
-
- We inherit from Cell (and not from SliderCell or ActionCell)
- because I thought gauges were basically for showing values, not
- altering them.
-
- The guts of this class originally came from the GaugeView in the
- BusyBox example located in /NextDeveloper/Examples/Appkit. I
- basically copied the code here, changed the pswraps to allow for
- color, changed the method names and used inherited cell methods,
- and replaced the cache window with an NXImage.
-
- See the implementation file for the original comments that came
- with the GaugeView. (I suppose you could also find it in the
- /NextDev/Examples directory).
-
- This object is included in the MiscKit by permission from the author
- and its use is governed by the MiscKit license, found in the file
- "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- for a list of all applicable permissions and restrictions.
- *****************************************************************************/
-
- #import <appkit/Cell.h>
-
- @class NXImage;
- @class Font;
-
-
- @interface MiscGaugeCell : Cell
- {
- NXImage *cache; // Cache for non-moving display of gauge.
- Font *titleFont; // Font of the title. (Numbers use cell's font)
- short titlePosition; // Either NX_ATTOP or NX_ATBOTTOM.
- float radius; // Radius of gauge face.
- NXPoint center; // Center of gauge face.
- float startAngle; // Angle in degrees where the min value is.
- float angleRange; // Range in degrees which hand spans.
- float degreesPerUnit; // Ratio of degrees to units.
- int tickInterval; // Interval of tick marks on gauge face.
- float tickRatio; // Tick radius in ratio to face radius.
- float handRatio; // Length of hand in ratio to face radius.
- // NXColor backgroundColor;
- NXColor gaugeColor;
- NXColor textColor;
- float minValue;
- float maxValue;
- float value; // Current value of the gauge.
- char *strValue; // Used in stringValue.
- }
-
- + initialize;
- - init;
- - free;
-
- - (float)maxValue;
- - (float)minValue;
- - (float)floatValue;
- - (double)doubleValue;
- - (int)intValue;
- - (const char *)stringValue;
-
- - setMaxValue: (float)max;
- - setMinValue: (float)min;
- - setFloatValue: (float)val;
- - setDoubleValue: (double)val;
- - setIntValue: (int)val;
- - setStringValue: (const char *)val;
-
- - (float)startAngle;
- - (float)angleRange;
- - (int)tickInterval;
- - (float)tickRatio;
- - (float)handRatio;
-
- - setStartAngle:(float)newValue;
- - setAngleRange:(float)newValue;
- - setTickInterval:(int)newValue;
- - setTickRatio: (float)newRatio;
- - setHandRatio: (float)newRatio;
-
- //- (NXColor)backgroundColor;
- - (NXColor)gaugeColor;
- - (NXColor)textColor;
- //- setBackgroundColor: (NXColor)color;
- - setGaugeColor: (NXColor)color;
- - setTextColor: (NXColor)color;
-
- //- (float)backgroundGray;
- - (float)gaugeGray;
- - (float)textGray;
- //- setBackgroundGray: (float)gray;
- - setGaugeGray: (float)gray;
- - setTextGray: (float)gray;
-
- - titleFont;
- - setTitleFont: newFont;
- - (const char *)title;
- - setTitle: (const char *)newTitle;
- - (int)titlePosition;
- - setTitlePosition: (int)newPos;
-
- - calcCellSize: (NXSize *)size inRect:(NXRect *)rect;
-
- - drawSelf: (const NXRect *)rect inView: controlView;
- - drawInside:(const NXRect *)cellFrame inView:aView;
- - drawHand: (const NXRect *)rect flipped: (BOOL)viewFlipped;
- - drawFace: (const NXRect *)rect;
- - highlight:(const NXRect *)cellFrame inView:aView lit:(BOOL)flag;
-
- - awake;
- - read: (NXTypedStream *)stream;
- - write: (NXTypedStream *)stream;
-
- @end
-
-